/**
 * Created by IntelliJ IDEA.
 * User: LiuWenqi
 * Date: 2017-12-08
 * Time: 16:45
 * Description:
 */
package com.example.layui.controller;

import com.example.layui.entity.Module;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/index")
public class IndexController {
    @RequestMapping("toIndex")
    public String toIndex2(ModelMap modelMap) {
        List<Module> list = new ArrayList<>();
        Module resource = new Module("1", "资源管理", "/", "icon-wenjianjia2", "0");
        Module systemRegister = new Module("2", "系统注册", "/system/toSystemRegister", "icon-wenjianjia2", "1");
        Module systemResource = new Module("3", "系统资源管理", "/system/toSystemResource", "icon-wenjianjia2", "1");
        Module structureAndUser = new Module("4", "组织与用户管理", "/", "icon-wenjianjia2", "0");
        Module structure = new Module("5", "组织机构", "/structure/toStructure", "icon-wenjianjia2", "4");
        Module user = new Module("6", "用户管理", "/structure/toUser", "icon-wenjianjia2", "4");
        Module authority = new Module("7", "权限管理", "/", "icon-wenjianjia2", "0");
        Module role = new Module("8", "角色管理", "/authority/toAuthority", "icon-wenjianjia2", "7");
        Module userAndRole = new Module("9", "用户角色管理", "/authority/toUserRole", "icon-wenjianjia2", "7");
        Module roallocate = new Module("10", "用户角色权限分配", "/authority/toAllocate", "icon-wenjianjia2", "7");

        resource.addChild(systemRegister);
        resource.addChild(systemResource);
        structureAndUser.addChild(structure);
        structureAndUser.addChild(user);
        authority.addChild(role);
        authority.addChild(userAndRole);
        authority.addChild(roallocate);

        list.add(resource);
        list.add(structureAndUser);
        list.add(authority);

        modelMap.put("moduleDTOList", list);

        return "layout/index";
    }
}
